package com.situ.mymall.controller;

import com.situ.mymall.pojo.entity.PayInfo;
import com.situ.mymall.pojo.query.PayInfoQuery;
import com.situ.mymall.service.IPayInfoService;
import com.situ.mymall.util.PageResult;
import com.situ.mymall.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/payInfo")
public class PayInfoController {

    @Autowired
    private IPayInfoService payInfoService;

    @RequestMapping("/list")
    public PageResult list(PayInfoQuery payInfoQuery){
        return payInfoService.list(payInfoQuery);
    }

    @RequestMapping("/selectById")
    public Result selectById(Integer id){
        PayInfo payInfo = payInfoService.selectById(id);
        return Result.ok(payInfo);
    }

    @RequestMapping("/add")
    public Result add(PayInfo payInfo){
        payInfoService.add(payInfo);
        return Result.ok("添加成功");
    }

    @RequestMapping("/deleteById")
    public Result deleteById(Integer id){
        payInfoService.deleteById(id);
        return Result.ok("删除成功");
    }

    @RequestMapping("/deleteAll")
    public Result deleteAll(Integer[] ids){
        payInfoService.deleteAll(ids);
        return Result.ok("删除成功");
    }

    //PayInfoMapper.xml未写
    @RequestMapping("/update")
    public Result update(PayInfo payInfo){
        payInfoService.update(payInfo);
        return Result.ok("更新成功");
    }


}
